home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / mee / vbdao / visdata / tables.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-06  |  5.7 KB  |  203 lines

  1. VERSION 2.00
  2. Begin Form fTables 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "<none>"
  5.    ClientHeight    =   3255
  6.    ClientLeft      =   510
  7.    ClientTop       =   1575
  8.    ClientWidth     =   3000
  9.    Height          =   3660
  10.    Icon            =   0
  11.    Left            =   450
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    ScaleHeight     =   3235.273
  16.    ScaleMode       =   0  'User
  17.    ScaleWidth      =   3020.895
  18.    Top             =   1230
  19.    Width           =   3120
  20.    Begin CommandButton NewTableButton 
  21.       Caption         =   "&New"
  22.       Height          =   375
  23.       Left            =   120
  24.       TabIndex        =   4
  25.       Top             =   120
  26.       Width           =   855
  27.    End
  28.    Begin CommandButton StructButton 
  29.       Caption         =   "&Design"
  30.       Height          =   375
  31.       Left            =   2040
  32.       TabIndex        =   2
  33.       Top             =   120
  34.       Width           =   855
  35.    End
  36.    Begin CommandButton OpenButton 
  37.       Caption         =   "&Open"
  38.       Height          =   375
  39.       Left            =   1080
  40.       TabIndex        =   1
  41.       Top             =   120
  42.       Width           =   855
  43.    End
  44.    Begin ListBox cTableList 
  45.       BackColor       =   &H00FFFFFF&
  46.       Height          =   2175
  47.       Left            =   120
  48.       Sorted          =   -1  'True
  49.       TabIndex        =   0
  50.       Tag             =   "OLS"
  51.       Top             =   855
  52.       Width           =   2775
  53.    End
  54.    Begin Label TableListLabel 
  55.       BackColor       =   &H00C0C0C0&
  56.       Caption         =   "Tables:"
  57.       Height          =   255
  58.       Left            =   120
  59.       TabIndex        =   3
  60.       Top             =   584
  61.       Width           =   2775
  62.    End
  63. Option Explicit
  64. Sub cTableList_DblClick ()
  65.   gfFromSQL = False
  66.   Call OpenButton_Click
  67. End Sub
  68. Sub cTableList_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
  69.   If cTableList.ListIndex = -1 Then Exit Sub
  70.   If Button = 2 Then
  71.     PopupMenu VDMDI.PUMMain, 2
  72.   End If
  73. End Sub
  74. Sub Form_Load ()
  75.   If gfDBOpenFlag = True Then
  76.     caption = gstDBName & "." & gstDataBase
  77.   End If
  78.   'set the height and width
  79.   Dim x As Integer
  80.   x = Val(GetINIString("TBLWindowHeight", "3870"))
  81.   Height = x
  82.   x = Val(GetINIString("TBLWindowWidth", "3135"))
  83.   Width = x
  84.   x = Val(GetINIString("TBLWindowTop", "0"))
  85.   Top = x
  86.   x = Val(GetINIString("TBLWindowLeft", "0"))
  87.   Left = x
  88. End Sub
  89. Sub Form_Paint ()
  90.   Outlines Me
  91. End Sub
  92. Sub Form_Resize ()
  93.   On Error Resume Next
  94.   If WindowState <> 1 Then
  95.     cTableList.Height = Height - 1350
  96.     cTableList.Width = Width - 320
  97.     Outlines Me
  98.     Me.Refresh
  99.   End If
  100. End Sub
  101. Sub Form_Unload (Cancel As Integer)
  102.   Me.WindowState = 1
  103.   Cancel = True
  104. End Sub
  105. Sub NewTableButton_Click ()
  106.   If gfDBOpenFlag = False Then
  107.     MsgBox "No DataBase Open", 48
  108.     Exit Sub
  109.   End If
  110.   gfAddTableFlag = True
  111.   fTblStru.Show MODAL
  112. End Sub
  113. Sub OpenButton_Click ()
  114.   On Error Resume Next
  115.   Dim qd As QueryDef
  116.   Dim iTableType As Integer
  117.   Dim ActionQuery As String
  118.   If Len(cTableList) = 0 Then
  119.     MsgBox "No Table Selected", 48
  120.     Exit Sub
  121.   End If
  122.   gfFromSQL = False
  123.   SetHourglass Me
  124.   iTableType = TableType((cTableList))
  125.   'check to see if the selected table is
  126.   'actually a querydef in an Access database
  127.   'and display the SQL if pref is set
  128.   If gstDataType = MSACCESS Then
  129.     If iTableType = DB_QUERYDEF Then
  130.       Set qd = gCurrentDB.OpenQueryDef(cTableList)
  131.       gstDynaString = qd.SQL
  132.       ActionQuery = ActionQueryType((cTableList))
  133.       If VDMDI.PrefDisplaySQL.Checked = True Then
  134.         fSQL.cSQLStatement = qd.SQL
  135.       End If
  136.     End If
  137.   End If
  138.   'create a new dynaset form
  139. '  gstDynaString = NULL_STR
  140.   If VDMDI.cSingleRecord = True Then
  141.     If iTableType = DB_QUERYDEF Then
  142.       If Len(ActionQuery) = 0 Then
  143.         MsgBar "Opening Query Dynaset", True
  144.         Dim dsform1 As New fDynaset
  145.         dsform1.Show
  146.       Else
  147.         ResetMouse Me
  148.         If MsgBox("Run " & ActionQuery & " Query?", MSGBOX_TYPE) = YES Then
  149.           SetHourglass Me
  150.           MsgBar "Executing " & ActionQuery & " Query", True
  151.           qd.Execute
  152.         End If
  153.       End If
  154.     ElseIf iTableType = DB_ATTACHEDTABLE Then
  155.       MsgBar "Opening Dynaset on Attached Table", True
  156.       Dim dsform2 As New fDynaset
  157.       dsform2.Show
  158.     ElseIf iTableType = DB_ATTACHEDODBC Then
  159.       MsgBar "Opening Dynaset on Attached ODBC Table", True
  160.       Dim dsform3 As New fDynaset
  161.       dsform3.Show
  162.     ElseIf gstDataType = SQLDB Then
  163.       MsgBar "Opening Dynaset on ODBC Table", True
  164.       Dim dsform4 As New fDynaset
  165.       dsform4.Show
  166.     Else
  167.       MsgBar "Opening Table", True
  168.       Dim tblform As New fTableObj
  169.       tblform.Show
  170.     End If
  171.   ElseIf Len(ActionQuery) > 0 Then
  172.     ResetMouse Me
  173.     Beep
  174.     MsgBox "Action Query Not Allowed w/ Data Control or Grid!", 16
  175.   ElseIf VDMDI.cDataCtl = True Then
  176.     MsgBar "Opening Full Table Dynaset w/ Data Control", True
  177.     Dim dsform5 As New fDataForm
  178.     dsform5.Show
  179.   ElseIf VDMDI.cTableView = True Then
  180.     MsgBar "Opening Full Table Dynaset in Grid", True
  181.     Dim dsgrid1 As New fGridFrm
  182.     dsgrid1.Show
  183.   Else
  184.     MsgBar "Opening Full Table Snapshot in Grid", True
  185.     Dim dsgrid2 As New fGridFrmSS
  186.     dsgrid2.Show
  187.   End If
  188.   ResetMouse Me
  189.   MsgBar NULL_STR, False
  190. End Sub
  191. Sub StructButton_Click ()
  192.   On Error Resume Next
  193.   If Len(cTableList) = 0 Then
  194.     MsgBox "No Table Selected", 48
  195.     Exit Sub
  196.   End If
  197.   gfAddTableFlag = False
  198.   fTblStru.Show MODAL
  199. End Sub
  200. Sub TableListLabel_DblClick ()
  201.    RefreshTables cTableList, True
  202. End Sub
  203.